<template>
	<view class="u-page">
		<view class="header" :style="{backgroundImage:'url('+data.pic+')'}">
			<view class="nav-bar">
				<uni-nav-bar left-icon="back" @clickLeft="goback()" color="#ffffff" :border="border" statusBar="true"
					backgroundColor="transparent">
					<view slot="left" class="sitename">项目详情</view>
				</uni-nav-bar>
			</view>

		</view>
		<view class="content">
			<view class="project">
				<view class="projecttitle">
					<view class="title">{{data.title}}</view>
					<view class="shareIcon">
						<image src="../../static/icon/shouchang.png" mode=""></image>
						<image src="../../static/icon/share.png" mode=""></image>
					</view>
				</view>
				<view class="projectinfo">{{data.contentInfo}}</view>
				<view class="tags">
					<block v-for="(item,index) in data.tag" :key="index">
						<uni-tag class="tag" :text="item" type="primary" circle="true"></uni-tag>
					</block>
				</view>
			</view>
			<view class="projectCol">
				<uni-grid :column="3" :showBorder="border" @change="gridLink()">
					<uni-grid-item :index="0">
						<view class="gridcol">
							<image src="../../static/icon/project.png" mode=""></image>
						</view>
						<view class="grid-text">合同详情</view>
					</uni-grid-item>
					<uni-grid-item :index="1">
						<view class="gridcol">
							<image src="../../static/icon/users.png" mode=""></image>
						</view>
						<view class="grid-text">股东介绍</view>
					</uni-grid-item>
					<uni-grid-item :index="2">
						<view class="gridcol">
							<image src="../../static/icon/code.png" mode=""></image>
						</view>
						<view class="grid-text">二维码</view>
					</uni-grid-item>
				</uni-grid>
			</view>

			<view class="projectCell">
				<view class="title">经营数据</view>
				<view class="listlab">
					<view class="leftImg">
						<image src="../../static/icon/price.png" mode=""></image>
					</view>
					<view class="label">月累计销售额(30天)</view>
					<view class="price" v-if="orderinfo.month.sum != null">{{orderinfo.month.sum}}</view>
					<view class="price" v-else>0</view>
				</view>
				<view class="listlab">
					<view class="leftImg">
						<image src="../../static/icon/price.png" mode=""></image>
					</view>
					<view class="label">近7天销售额</view>
					<view class="price" v-if="orderinfo.week.sum != null">{{orderinfo.week.sum}}</view>
					<view class="price" v-else>0</view>
				</view>
				<view class="listlab">
					<view class="leftImg">
						<image src="../../static/icon/price.png" mode=""></image>
					</view>
					<view class="label">昨日销售额</view>
					<view class="price" v-if="orderinfo.today.sum != null">{{orderinfo.today.sum}}</view>
					<view class="price" v-else>0</view>
				</view>

			</view>
			<view class="projectCol1">
				<view class="title">
					<view class="jiange">
						<uni-row class="demo-uni-row">
							<uni-col :span='6'>
								<view class="remen">营销应用 </view>
							</uni-col>
							<uni-col :span='18'>
								<view class="more" @click="gridpage()">更多应用 <image
										src="../../static/icon/more.png" mode=""></image>
								</view>
							</uni-col>
						</uni-row>
					</view>
				</view>
				<uni-grid :column="3" :showBorder="border" @change="gridpage()">
					<uni-grid-item :index="0" class="garid_group">
						<view class="gridcol">
							<image src="../../static/icon/project.png" mode=""></image>
						</view>
						<view class="grid-text">线上商城</view>
					</uni-grid-item>
					<uni-grid-item :index="1" class="garid_group">
						<view class="gridcol">
							<image src="../../static/icon/users.png" mode=""></image>
						</view>
						<view class="grid-text">外卖商城</view>
					</uni-grid-item>
					<uni-grid-item :index="2" class="garid_group">
						<view class="gridcol">
							<image src="../../static/icon/code.png" mode=""></image>
						</view>
						<view class="grid-text">酒吧营销</view>
					</uni-grid-item>
				</uni-grid>
			</view>
			<view class="projectContent">
				<!-- <rich-text :nodes="data.projectInfo"></rich-text> -->
				<u-parse :content="data.power" ></u-parse>
			</view>

		</view>
		<!-- <view class="footer">
			  <navigator url="/pages/project/investment"><button type="warn" class="button">我要投资</button></navigator>
      
		</view> -->

	</view>
</template>

<script>
	import uParse from '@/components/u-parse/u-parse.vue'
	export default {
		components: {
		    uParse
		  },
		data() {
			return {
				pid: '',
				border: false,
				strings: '',

				data: {},
				orderinfo: {}
			}
		},
		onLoad: function(option) {
			// console.log(option)
			this.pid = option.id
			this.propert(option.id)
		},
		methods: {
			goback() {

				uni.navigateBack({
					delta: 1
				})
			},
			//获取项目数据
			async propert(pid) {
				const project = await this.GQL({
					"operationName": "allSlProjects",
					"query": "query allSlProjects($filter: SlProjectFilter) { allSlProjects(filter: $filter) { nodes { title projectInfo type tag status pic pid contentInfo cashier power} } }",
					"variables": {
						"filter": {
							"pid": {
								"equalTo": pid
							}
						}
					}
				})
				if (project.data.allSlProjects.node != '') {
					project.data.allSlProjects.nodes.forEach(function(item, index) {
						if (item.tag) {
							item.tag = item.tag.split(',')
						}
					});
					this.data = project.data.allSlProjects.nodes[0]
					if (this.data.cashier == '1') { //哗啦啦收银
						let that = this
						uni.request({
							url: that.HttpServe + '/Hll/hllOrderInfo',
							data: {
								pid: that.pid
							},
							method: "post",
							success(res) {
								if (res.data.code == 200) {
									let info = res.data
									that.orderinfo = info.data
									console.log('11111----', that.orderinfo)
								} else {
									uni.showToast({
										title: '获取信息失败',
										icon: 'error',
										duration: 3000
									});
								}
								// 1994年10月20日
								// console.log('res--',res)
							},
							fail(err) {
								console.log('res--', err)
							}
						})
					}
				}






			},
			gridpage(id){
				uni.showToast({
					title: '暂无权限查看！',
					icon: 'error',
					duration: 3000
				});
			},
			gridLink(id) {
				if (id.detail.index == 2) {
					uni.navigateTo({
						url: "/pages/user/invest/qrCode?id=" + this.pid
					})
				} else if (id.detail.index == 1) {
					uni.navigateTo({
						url: "/pages/project/info/shareholder?id=" + this.pid + "&title=股东介绍"
					})
				} else {
					uni.navigateTo({
						url: "/pages/user/invest/contract?id=" + this.pid
					})
				}

			}
		}
	}
</script>

<style lang="scss">
	.u-page {
		background-color: #FBFCFE;
	}

	.header {
		width: 100%;
		height: 260px;
		background-repeat: no-repeat;
		background-size: cover;

		/* color: #FFFFFF; */
		// background-image: url('https://cdn.uviewui.com/uview/album/3.jpg');
		.nav-bar {
			.uni-navbar__header {
				padding-left: 15px;
			}

			.uni-navbar__header-btns-left {
				width: 150px;
			}

			.sitename {
				height: 50px;
				font-size: 18px;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 550;
				text-align: left;
				color: #FFFFFF;
			}
		}
	}

	.content {
		position: relative;
		top: -180px;

		margin: 15px;

	}

	.project {
		.projecttitle {
			color: #FFFFFF;
			font-weight: 600;
			line-height: 25px;
			height: 30px;

			// height: 28px;
			.title {
				font-size: 18px;
				width: 80%;

				height: 28px;
				overflow: hidden;
			}

			.shareIcon {
				top: -25px;
				position: relative;
				display: flex;
				justify-content: flex-end;

				image {
					width: 20px;
					height: 20px;
					margin-left: 15px;
				}
			}

		}

		.projectinfo {
			line-height: 15px;
			margin: 10px 0px;
			font-size: 11px;
			color: #ffffff;
			font-weight: 400;
			width: 100%;
			height: 17px;
			overflow: hidden;
		}

		.tags {
			width: 100%;
			margin-top: 10px;

			.tag {
				margin-right: 5px;
			}
		}
	}

	.projectCol1 {
		margin-top: 12px;
		padding: 20px;
		border-radius: 10px;
		background-color: #FFFFFF;
		// text-align: center;
		// display: block;
		// justify-content: center;
		box-shadow: 1px -2px 10px 6px rgba(0, 0, 0, 0.1);

		.garid_group {
			text-align: center;
		}

		.gridcol {
			margin-top: 5px;
		}

		.grid-text {
			padding-bottom: 10px;
			font-size: 15px;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #767B8D;
			line-height: 21px;
		}

		image {
			width: 72px;
			height: 72px;
		}

		.title {
			padding-top: 0;
		}

		.jiange {
			margin: 0px;
			margin-bottom: 10px;
			width: 100%;

			.remen {
				font-size: 16px;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 600;
				color: #161E3E;
				line-height: 16px;
			}

			.more {
				text-align: right;
				font-size: 12px;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #9BA7C1;
				line-height: 16px;

				image {
					width: 10px;
					height: 10px;
				}
			}
		}

	}

	.projectCol {
		margin-top: 30px;
		border-radius: 10px;
		background-color: #FFFFFF;
		// height: 140px;
		text-align: center;
		display: block;
		justify-content: center;
		box-shadow: 1px -2px 10px 6px rgba(0, 0, 0, 0.1);

		.gridcol {
			margin-top: 5px;
		}

		.grid-text {
			padding-bottom: 10px;
			font-size: 15px;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #767B8D;
			line-height: 21px;
		}

		image {
			width: 72px;
			height: 72px;
		}
	}

	.projectCell {
		margin-top: 12px;
		background-color: #FFFFFF;
		border-radius: 10px;
		padding: 10px 16px 6px 16px;
		box-shadow: 1px -2px 10px 6px rgba(0, 0, 0, 0.1);

		// background-color: #000;
		.listlab {
			display: flex;
		}

		.title {
			font-size: 16px;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 600;
			color: #161E3E;
			line-height: 16px;
			padding: 10px 0;
		}

		.listlab {
			display: flex;
			margin: 15px 0px;
		}

		.label {
			flex: 1;
			font-size: 15px;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #161E3E;
			margin: 0px 10px;
			line-height: 18px;
		}

		.price {
			font-size: 15px;
			font-family: PingFangSC-Semibold, PingFang SC;
			font-weight: 600;
			color: #E73B42;
			line-height: 18px;
		}

		.leftImg {
			// padding-left: 10px;

			image {
				width: 14px;
				height: 15px;
			}
		}
	}

	.projectContent {
		margin-top: 20px;
	}

	.footer {
		background-color: #FFFFFF;
		height: 60px;
		width: 100%;

		.button {
			margin: 15px;
		}
	}
</style>
